export  interface Address {
    value: string;
    label: string;
    levelId: string;
    children?: Address[];
  hasChildren:boolean
  }
  export function convertData(data: any[]): Address[] {
    if (Array.isArray(data) && data.length) {
      return data.map((item) => {
        const address: Address = {
          value: item.id, // 地址编码
          label: item.name, // 地址名称
          levelId:item.levelId,
          children: item.childNodeList? convertData(item.childNodeList) : [], // 递归转换子地址
          hasChildren: true, // 该节点没有子节点
        };
        return address;
      });
    } else {
      return [];
    }
  }
  export  interface Addressa {
    value: string;
    label: string;
    children?: Addressa[];
  hasChildren:boolean
  }
  export function convertDataA(data: any[]): Addressa[] {
    if (Array.isArray(data) && data.length) {
      return data.map((item) => {
        const address: Addressa = {
          value: item.id, // 地址编码
          label: item.name, // 地址名称
          children: item.children? convertDataA(item.children) : [], // 递归转换子地址
          hasChildren: true, // 该节点没有子节点
        };
        return address;
      });
    } else {
      return [];
    }
  }
  export  interface Addressd {
    value: string;
    label: string;
    pid: string;
    objectVersionNumber:string;
    children?: Addressd[]|undefined;
  }
  // 这是我改的数据
  export function convertDatad(data: any[]): Addressd[] {
    if (Array.isArray(data) && data.length) {
      return data.map((item) => {
        const addressd: Addressd = {
          value: item.id,
          label: item.groupName,
          pid:item.pid,
          objectVersionNumber:item.objectVersionNumber,
          children: item.childNodeList? convertDatad(item.childNodeList) : [], // 递归转换子地址
        };
        return addressd;
      });
    } else {
      return [];
    }
  }
  export function convertDatads(data: any[]): Addressd[] {
    if (Array.isArray(data) && data.length) {
      return data.map((item) => {
        const addressd: Addressd = {
          value: item.id,
          label: item.organizationName,
          pid:item.pid,
          objectVersionNumber:item.objectVersionNumber,
          children: item.childNodeList? convertDatads(item.childNodeList) : [], // 递归转换子地址
        };
        return addressd;
      });
    } else {
      return [];
    }
  }
  export  interface Addressdd {
    value: string;
    label: string;
    children?: Addressd[];
  objectVersionNumber:any
  }
  export function convertDatade(data: any[]): Addressdd[] {
    if (Array.isArray(data) && data.length) {
      return data.map((item) => {
        const addressd: Addressdd = {
          value: item.id,
          label:item.roleName,
          objectVersionNumber:item.objectVersionNumber,
          children: item.childNodeList? convertDatads(item.childNodeList) : [], // 递归转换子地址
        };
        return addressd;
      });
    } else {
      return [];
    }
  }